package com.lams.test;

public class TreeNode {
	public String id;
	public String text;
	public String parentId;
	public String flag;
	public String clazz;
	public String href;
	public boolean isShow;
	public Children children = new Children();
	
	public String toString(){
		String checked = "1".equals(flag)?"true":"false";
		String result = "{" 
				+ "id:'"+id+"'"
				+ ", text: '"+text+"'"
				+ ",clazz:'"+clazz+"'"
				+ ",url:'"+ href +"'"
				+ ",checked:"+checked;
		if(children!=null && children.getSize()!=0){
			result += ", children:"+ children.toString();
		}else{
			result += ",leaf:true";
		}
		result += "}";
		return result;
	}
	
	public void sortChildren(){
		if(children!=null && children.getSize()!=0){
			children.sortChildren();
		}
	}
}
